package reflect;

import reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

public class Test4 {
    public static void main(String[] args) throws Exception {
        Class cls= Person.class;
        Method[] md=cls.getDeclaredMethods();
        for(Method m:md) {
            if (m.isAnnotationPresent(AutoRunMethod.class)){
                Object obj=cls.newInstance();
                m.invoke(obj);
            }
        }
    }
}
